import requestUtil from "@/utils/requestUtil";

const INVENTORYRECORD_BASE_URL = "/business/inventoryRecord";
import type { UploadUserFile } from "element-plus";
import { Attachment, IObject } from "@/api/common/common";
import {InventoryOperation_LABEL, InventoryOperation} from "@/api/business/warehouse/warehouseEnum";

const InventoryRecordAPI = {
  /** 获取仓库分页数据 */
  getPage(queryParams?: InventoryRecordPageQuery) {
    return requestUtil.get<PageResult<InventoryRecordPageVO[]>>(
      `${INVENTORYRECORD_BASE_URL}/loadPage`,
      queryParams
    );
  },

  /**
   * 获取仓库表单数据
   *
   * @param id 仓库ID
   * @returns 仓库表单数据
   */
  getFormData(id: string) {
    return requestUtil.get<InventoryRecordPageVO>(`${INVENTORYRECORD_BASE_URL}/load/${id}`);
  },
};

export default InventoryRecordAPI;

/** 分页查询参数 */
export interface InventoryRecordPageQuery extends PageQuery {
  /** 搜索关键字 */
  warehouseId ?: string;
  sku ?: string;
  operation ?: InventoryOperation;
}


export interface InventoryRecordPageVO {
  /** ID */
  id?: string;
  warehouseName?: string;
  title?: string;
  operation?: InventoryOperation;
  operationTime?: string;
  username?: string;
  userId?: string;
  warehouseId?: string;
  items?: InventoryRecordMaterialVO[];
  deliveryNo?:string;
}


export interface InventoryRecordMaterialVO {
  /** ID */
  id?: string;
  inventoryRecordId?: string;
  materialId?: string;
  sku?: InventoryOperation;
  quantity?: string;
  name?: string;
  unit?: string;
  spec?: string;
  price?: string;
  costPrice?: string;
  warehouseId?: string;
}


